<%@page contentType="text/html" pageEncoding="UTF-8" import="java.io.*, java.sql.*, javax.sql.*"%>
<%

    Connection con = com.elookinto.wordlist.Util.getCon();
    PreparedStatement st = null;
    String note = null;
    st = con.prepareStatement("select limit 0 200 uid, url, title, desc, id, insert_time from recording order by insert_time desc ");
    ResultSet rs = st.executeQuery();
    rs = st.executeQuery();
    int i = 0;
    java.text.DateFormat dateFormat= new java.text.SimpleDateFormat("yyyy.MM.dd");
    while (rs.next()) {
        String uid = rs.getString("uid");
        String url = rs.getString("url");
        String title = rs.getString("title");
        String desc = rs.getString("desc");
        String id = rs.getString("id");
        Date d = new Date(rs.getTimestamp("insert_time").getTime());
        
        i++;
      if (url == null || uid ==null ) continue;
%>

<button  <%= uid.equals(session.getAttribute("uid"))?"":"disabled" %>  style="color:red" onclick='del("<%= uid%>", "<%= url%>")'> X </button>  
<button   onclick='addDialog("<%= id%>")'  style="color:red"  > Add Comment</button>  
<a id='b0<%= i%>' href="javascript:void(0)" 
   onclick="playAudio('<%=url%>', this)"
   onmouseover='commentDialogMouse("<%= id%>")'
   onmouseout=' $("#commentDialog").dialog("close");'
   title="<%=desc %>"> <%= title==null||title.trim().length()==0?"Untitled Audio":title %> </a> by <%=uid%> -- <%= dateFormat.format(d) %><br/>
<div class="comm" id="comm<%=id%>" style=" ">
</div>
<%}
    rs.close();
    st.close();
    con.close();
%>

<script>
    
   function comment(myid)
   {
       $.get("retrieveComment.jsp", function(data) {
           $.("#"+myid).css("display", "block");
           $.("#"+myid).html(data);
       })
   }
    $(function() {
        $( ".draggable" ).draggable({ revert: true});
        $( ".droppable" ).droppable({
            activeClass: "ui-state-hover",
            hoverClass: "ui-state-active",
            drop: function( event, ui ) {
                //alert();
                listName = $(this).text();
                $.post("save.jsp", {listName:$(this).text(),wordList:ui.draggable.text()}, function(data){
                    //alert("Saved " + ui.draggable.text());
                    //$('#message').css('display', 'block'); 
                    $("#message").text("Saved '" + ui.draggable.text() + "' to list " + listName +"!");
                })
                
            }
        });
    });
</script>
